package com.tn.controller;

import com.gitee.hifong45.Ret;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Slf4j
@RestController
public class CommonController {

    @GetMapping("/sys")
    public Ret<Object> getSysInfo() {

        return Ret.Ok();
    }

    @GetMapping("/gogogo")
    public String gogogo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        log.info("this is gogogo");
//        request.getRequestDispatcher("/logs").forward(request, response);
//        response.sendRedirect("/logs");
        return "forward:/logs";
    }
    @GetMapping("/go2")
    public void go2(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        log.info("this is gogogo");
//        request.getRequestDispatcher("/logs").forward(request, response);
        response.sendRedirect("/logs");
//        return "forward: logs";
    }
}
